﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace MVCPets.Extensions
{
  public static class StreamExtensions
  {
    public static byte[] ToByteArray(this Stream input)
    {
      var streamLength = Convert.ToInt32(input.Length);
      var fileData = new byte[streamLength];
 
      input.Read(fileData, 0, streamLength);
      input.Close();
 
      return fileData;
    }
  }
}